<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Napi\Controller;
/**
 * 前台公共控制器
 * 为防止多分组Controller名称冲突，公共Controller名称统一使用分组名称
 */
class ArticleController extends NapiController {
    public function index(){
        echo 'Aticle 控制器';
    }

    public function mix_rand_around($category_id = 0,$limit = 3){
        if($category_id ==0)
            $this->ReturnClient(1,'缺少参数！');
        $where = array('status' =>1,'category_id'=>$category_id);
        $result = D('document')->where($where)->order('RAND()')->limit((int)$limit)->select();
        $this->ReturnClient(2,'相关阅读！',$result);
    }

    public function mix_magazine($code = 0,$limit = 3){
        $where = array('status' =>1,'code'=>$code);
        $result = D('magazine')->where($where)->order('RAND()')->limit((int)$limit)->select();
        $this->ReturnClient(2,'相关杂志！',$result);
    }

    public function article(){
        $title = $_REQUEST['title'];
        $content = $_REQUEST['content'];
    }
}
